-- corrosion_trigger
-- created by wangy
-- 受创触发（腐蚀）

return {
    apply = function(prop, baseValue)
        return baseValue;
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local target = arg;

        -- 腐蚀：减50%攻击，每回合减少当前攻击值的血量
        local propId = tonumber(prop[2]);
        local v = who:queryAttrib("attack");

        -- 持续时间，没有配置则默认为9
        local round = CombatM.getRound();
        if prop[3] > 0 then
            round = round + prop[3]
        else
            round = round + 9;
        end

        -- 减益状态
        local arr = ({ propId, 500, v, round, });
        local condition = {
            ["prop"] = arr,
            ["end_round"] = round,
        };

        -- 附加状态
        CombatStatusM.applyStatus(target, "corriosion", condition);

        return arr;
    end,

    record = function(target, prop, path)
        return false;
    end
};
